import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:get/get.dart';
import 'package:surfaceim/common/widgets/button.dart';
import 'package:surfaceim/pages/user/baseInfo/controller.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class BaseInfoPage extends GetView<BaseInfoController> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("基本信息"),
      ),
      body: SingleChildScrollView(
          child: Container(
        width: 1.sw,
        child: Column(
          mainAxisAlignment: MainAxisAlignment.start,
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [_buildTopCard(), _buildBaseList()],
        ),
      )),
      backgroundColor: Color.fromRGBO(249, 250, 252, 1),
    );
  }

  _buildTopCard() {
    return Container(
      margin: EdgeInsets.only(top: 30.h),
      decoration: BoxDecoration(
          color: Colors.white,
          borderRadius: BorderRadius.all(Radius.circular(8.w))),
      width: 709.w,
      padding: EdgeInsets.fromLTRB(
        38.w,
        22.h,
        38.w,
        22.h,
      ),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.start,
        children: [
          Container(
            height: 44.h,
            width: 36.w,
            color: Color.fromRGBO(97, 193, 253, 1),
          ),
          Expanded(
              child: Container(
            margin: EdgeInsets.only(left: 21.w),
            child: Text(
              "为了大家的恋爱体验，个人资料请如实填写，请严格遵守相关法律法规",
              style: TextStyle(
                  color: Color.fromRGBO(51, 51, 51, 1),
                  fontSize: 26.sp,
                  height: 3.5.h),
              overflow: TextOverflow.clip,
            ),
          ))
        ],
      ),
    );
  }

  _buildBaseList() {
    return Container(
      width: 709.w,
      decoration: BoxDecoration(color: Colors.white),
      margin: EdgeInsets.only(top: 30.h),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Container(
            alignment: Alignment.center,
            padding: EdgeInsets.only(top: 51.h, bottom: 51.h),
            child: Container(
              decoration: BoxDecoration(
                  image: DecorationImage(
                      fit: BoxFit.cover,
                      image: AssetImage(
                        "assets/images/meinv.jpeg",
                      )),
                  borderRadius: BorderRadius.all(Radius.circular(85.h))),
              height: 162.h,
              width: 162.h,
            ),
          ),
          Obx(() {
            List<Widget> list = List.empty(growable: true);
            for (var i = 0; i < controller.listInfo.length; i++) {
              list.add(Container(
                padding: EdgeInsets.only(left: 30.w, right: 30.w),
                margin: EdgeInsets.only(
                    bottom: i == controller.listInfo.length - 1 ? 68.h : 78.h),
                child: Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: [
                    Container(
                      child: Text(
                        controller.listInfo[i].title,
                        style: TextStyle(
                            fontSize: 30.sp,
                            color: Color.fromRGBO(51, 51, 51, 1),
                            fontWeight: FontWeight.bold),
                      ),
                    ),
                    Row(
                      children: [
                        Text(
                          controller.listInfo[i].descText,
                          style: TextStyle(
                              color: Color.fromRGBO(153, 153, 153, 1),
                              fontSize: 30.sp),
                        )
                      ],
                    )
                  ],
                ),
              ));
            }
            return Column(
              children: list,
            );
          }),
          Row(
            children: [
              Container(
                width: 30.w,
              ),
              Text(
                "联系方式",
                style: TextStyle(
                    color: Color.fromRGBO(153, 153, 153, 1), fontSize: 28.sp),
              ),
              Container(
                width: 10.w,
              ),
              Text(
                "联系方式填写一个即可",
                style: TextStyle(
                    color: Color.fromRGBO(255, 112, 40, 1), fontSize: 28.sp),
              )
            ],
          ),
          Container(
            height: 39.h,
          ),
          Obx(() {
            List<Widget> list = List.empty(growable: true);
            for (var i = 0; i < controller.contactList.length; i++) {
              list.add(Container(
                padding: EdgeInsets.only(left: 30.w, right: 30.w),
                margin: EdgeInsets.only(
                    bottom:
                        i == controller.contactList.length - 1 ? 68.h : 78.h),
                child: Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: [
                    Container(
                      child: Text(
                        controller.contactList[i].title,
                        style: TextStyle(
                            fontSize: 30.sp,
                            color: Color.fromRGBO(51, 51, 51, 1),
                            fontWeight: FontWeight.bold),
                      ),
                    ),
                    Row(
                      children: [
                        Text(
                          controller.contactList[i].descText,
                          style: TextStyle(
                              color: Color.fromRGBO(153, 153, 153, 1),
                              fontSize: 30.sp),
                        )
                      ],
                    )
                  ],
                ),
              ));
            }
            return Column(
              children: list,
            );
          }),
          Container(
            margin: EdgeInsets.only(top: 120.h),
            alignment: Alignment.center,
            child: Column(
              children: [
                Row(
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: [
                    Text(
                      "个人信息安全保障中",
                      style: TextStyle(
                          color: Color.fromRGBO(51, 51, 51, 1),
                          fontSize: 22.sp),
                    )
                  ],
                ),
                Container(
                  height: 29.h,
                ),
                btnFlatButtonWidget(
                    onPressed: () {},
                    width: 370,
                    height: 80,
                    gbColor: Color.fromRGBO(250, 125, 150, 1),
                    title: "下一步",
                    fontSize: 30,
                    borderRadius: BorderRadius.all(Radius.circular(90.h))),
              ],
            ),
          )
        ],
      ),
    );
  }

  _buildItemList() {}
}
